using UnityEngine;
using System.Collections;

public class UImTabViewor : UImContainer
{
	
		public UIBar tabBar;

		override protected void initComponent ()
		{
				base.initComponent ();
				if (tabBar == null) {
						tabBar = ComponentUtils.fetchChildrenComponent<UIBar> (gameObject);
				}

				if (tabBar != null && tabBar.canComponent == null && containerTrans != null) {
						tabBar.canComponent = ComponentUtils.getComponentObject<CanComponent> (containerTrans.gameObject);
				}
		
				if (Input.GetKey (KeyCode.Escape)) {
						Application.Quit (); 
				}	
		}

		public override bool doAppear ()
		{
				if (base.doAppear ()) {
						if (tabBar != null) {
								(tabBar.canComponent.getActiveComponent () as UIViewor).doAppear ();
						}
			
						return true;
				}
		
				return false;
		}
	
		public override bool doDisappear ()
		{
				if (base.doDisappear ()) {
						if (tabBar != null) {
								(tabBar.canComponent.getActiveComponent () as UIViewor).doDisappear ();
						}
			
						return true;
				}
		
				return false;
		}
}
